#include "cc_stdio.h"
#include <share.h>
#include <tchar.h>
#include <stdio.h>
#include <stdarg.h>

FILE * cc_fopen(
	const char *fileName,
	const char *openMode 
	)
{
	return _tfsopen(fileName, openMode, _SH_DENYNO);
}

int __cdecl cc_fclose(
	FILE *stream
	)
{
	if(!stream)
		return -1;

	return _fclose_nolock(stream);
}

/*
int __cdecl cc_fflush( 
	FILE *stream 
)
{
	if(!stream)
		flsall(FFLUSHALL);

	return _fflush_nolock(stream);
}
*/


int __cdecl cc_printf(
	const char *format,
	...
	)
{
	va_list argulist;
	int ret;

	va_start(argulist, format);
	ret = vprintf(format, argulist);
	va_end(argulist);

	return ret;
}

// conversion_specification :e.g. %5ld
//void __cdecl cc_get_conversion_specification(
//	const char *format,
//	)
//int __cdecl cc_printf2(
//	const char *format,
//	...)
//{
//	const char *p = format;
//	while (*p != '\0')
//	{
//		char c = *p;
//		switch (c)
//		{
//		case :'%'
//
//			break;
//		}
//	}
//}
